define([
        "core",
        "list",
        "jQuery",
        "carousel"
    ], function (core, list, jQuery, carousel) {
        var index = {};

        String.prototype.endWith = function (str) {
            var reg = new RegExp(str + "$");
            return reg.test(this);
        }

        function init() {
            $('#ca-container').contentcarousel();

            $('ul li').click(function () {
                location.href = "/consumer/detail";
            });
            $('tr.sumary').hover(function () {
                $(this).css("cursor", "pointer");
                var id = $(this).attr("id");
                if ("sumary" == $(this).attr("class")) {
                    $("#" + id + "_detail").css('display', '');
                    $("#" + id + "_detail").css("background-color", "#eeeeee");
                }
                $(this).css("font-size", "18px");
                $(this).css("font-weight", "bold");
                $(this).css("background-color", "#eeeeee");
            }, function () {
                $(this).css("cursor", "pointer");
                var _id = $(this).attr("id");
                $("#" + _id + "_detail").css("display", "none");
                $(this).css("font-size", "16px");
                $(this).css("font-weight", "");
                $(this).css("background-color", "transparent");
            });

            $('tr').click(function () {
                location.href = "/consumer/detail";
            });

            $('a').hover(function () {
                $(this).css("cursor", "pointer");
                if ("classify" == $(this).attr("class")) {
                    $(this).css("color", "deepskyblue");
                }
            }, function () {
                if ("classify" == $(this).attr("class")) {
                    $(this).css("color", "black");
                }
            });

            $('.info-box').hover(function () {
                $(this).css("background-color", "#c2c2c2");
            }, function () {
                $(this).css("background-color", "#eeeeee");
            });

            $('.users-list.hot').find('li').each(function () {
                $(this).hover(function () {
                    $(this).css("background-color", "#eeeeee");
                    $(this).css("cursor", "pointer");
                }, function () {
                    $(this).css("background-color", "transparent");
                });
            });

            $('.users-list.common').find('li').each(function () {
                $(this).hover(function () {
                    var id = $(this).attr("id");
                    $(this).css("cursor", "pointer");
                    if ("sumary" == $(this).attr("class")) {
                        $("#" + id).css("display", "none");
                        $("#" + id + "_detail").css("display", "block");
                    }
                }, function () {
                    var _id = $(this).attr("id");
                    $(this).css("cursor", "pointer");
                    if (_id.endWith("_detail")) {
                        var id = _id.substring(0, _id.length - 7);
                        $("#" + id + "_detail").css("display", "none");
                        $("#" + id).css("display", "block");
                    }
                });
            });

            $('.nav').find('li').find("a").each(function () {
                $(this).hover(function () {
                    $(this).css("cursor", "pointer");
                    $(this).css("color", "#466eb7");
                }, function () {
                    $(this).css("color", "white");
                });
            })
        }

        index.init = init;
        return index;
    }
);